<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="vo.Message" %>
<%@ page import="java.util.List" %>
<%@ page import="dao.Messagedao" %>
<%@ page import="vo.User" %><%--
  Created by IntelliJ IDEA.
  User: 联想
  Date: 2024/12/17
  Time: 12:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>

<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="static/chatroom" />
    <script type="text/javascript">
        function f() {
            location.href="private.jsp"
        }
        function h() {
            location.href="index1.jsp"
        }
    </script>
</head>
<body>
<div class="all">
<div class="header"><h1>Chat Room</h1></div>
    <form action="<%=request.getContextPath()%>/MessageServlet" method="post">
    <div class="inputAll">
        <h2>欢迎你，${user.username}<h2>
        <div class="input">
            <label for="messages">你想说的话：</label>
            <textarea rows="20" cols="80"  id="text" name="text"></textarea>
        </div>
    </div>
        <div class="bottom">
            <button type="submit" class="button">发送</button>
        </div>
   </form>
        <div class="bottom">
        <button class="button" onclick="f()">私聊</button>
    </div>
     <div class="bottom">
         <button class="button" onclick="h()">进入博客主页</button>
    </div>
    <div id="messages">
    <c:forEach var="message" items="${sessionScope.messages}">
        <p><strong>${message.username}</strong>: (${message.time}) ${message.message} </p>
    </c:forEach>
</div>
</div>
</body>
</html>
